import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
// 防止通过代码跳转路由，控制台出现报错内容
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const routes = [
  {
    path: "",
    redirect: "/home",
  },
  {
    path: "/home",
    name: "Home",
    component: () => import("../views/Home.vue"),
  },
  {
    path: "/about",
    name: "About",
    component: () => import("../views/About.vue"),
  },
];
const router = new VueRouter({
  routes,
  mode: "history",
  linkActiveClass: "acitives",
});
export default router;
